<template>
 <div>
   <el-row>
     <el-col :span=24>
        <div style="float: left"> 
         <label for="assistant" style="font-size:20px;font-weight: 600; line-height: 40px;margin-right:5px">个人信息变更记录</label>
        </div>
        <div style="width:90px;float: right;margin: 0 43px 5px 0">
          <el-button type="success" icon="el-icon-back" @click="goBack" round>返回</el-button>
        </div>
      
     </el-col>
   </el-row>
   <el-row style="border-top: 1px solid black; margin-top: 15px">
     <el-table
      @row-click="checkChange"
      :cell-style="cellStyle"
      :header-cell-style="headCell"
      v-loading="loading"
      :data="tableData"
      border
      style="width: 100%;margin-bottom: 10px;padding-left:5px;padding-right:5px">
    <el-table-column
      label="辅导员姓名"
      prop="name"
      width="300">
    </el-table-column>
     <el-table-column
      label="身份证号"
      prop="idnumber"
      width="400">
    </el-table-column>
    <el-table-column width="700" label="修改内容">
      <template scope="scope">
        {{scope.row.name}} 于 {{scope.row.update_time}} 修改了 <span style="color: red">{{scope.row.ps}}</span>内容
      </template>
    </el-table-column>
    <el-table-column
      label="修改时间"
      sortable
      prop="update_time"
      width="280">
    </el-table-column>
    </el-table>
   </el-row>
   <el-row>
    <el-pagination
      v-show="allPage>1"
      layout="prev, pager, next"
      :page-count="allPage"
      :current-page="nowPage"
      @current-change="goPage" 
      class="pull-right" background>
    </el-pagination>
   </el-row>
 </div>
</template>

<script>
import http from '../../../../src/assets/js/http'
export default {
  data () {
    return {
      nowPage: 1,
      allPage: 1,
      form: {
        name: ''
      },
      tableData: [],
      loading: true,
      userInfo: Lockr.get('userInfo'),
    }
  },
  methods: {
    init() {
      console.log(this.userInfo)
      this.getTableData()
    },
    cellStyle(row, column, rowIndex, columnIndex) {
      return "text-align: center;color:#43519C"
    },
    headCell(row, column, rowIndex, columnIndex) {
      return "text-align: center;background:linear-gradient(#E8E8E8, #F8F8F8);color:#43519C"
    },
    getTableData() {
      let data = {
        id: this.$route.params.id,
        sch: this.userInfo.sch
      }
      console.log(data)
      this.apiPost('admin/Train/Teacherchange', data).then((res) => {
        this.handelResponse(res, (data) => {
          console.log(res)
          this.tableData = []
          data.data.forEach((element) => {
            this.tableData.push({
              name: element.name,
              ps: element.ps,
              update_time: element.updata_time,
              idnumber: element.idnumber
            })
          })
          this.allPage = data.data.last_page
          this.loading = false
        })
      })
    },
    // 返回上一个界面
    goBack() {
      // this.$router.go(-1)
      this.$router.push({
        name: 'infoList',
        params: {
          id: this.$route.params.id,
          searchName: this.$route.params.searchName
        }
      })

    },
    // 选择页面
    goPage(num) {
      this.nowPage = num
      this.getTableData()
    },
    // 查看某人修改的具体信息
    checkChange() {
      this.$router.push({
        name: 'personmsg',
        params: {
          id: this.$route.params.id,
          last: '2',
          searchName: this.$route.params.searchName
        }
      })
    }
  },
  created() {
    _g.closeGlobalLoading()
    this.init()
  },
  mounted() {
  },
  computed: {
  },
  components: {
  },
  mixins: [http]
}

</script scoped>
<style>
</style>
